import { Module } from "@nestjs/common";
import { UserService } from "./user.service";
import { UserController } from "./user.controller";
import { TypeOrmModule } from "@nestjs/typeorm";
import { User } from "@/modules/user/entities/user.entity";
import { ConfigModule, ConfigService } from "@nestjs/config";
import { JwtModule } from "@nestjs/jwt";
import { BaseController } from "@/modules/user/base.controller";

@Module({
	imports: [
		TypeOrmModule.forFeature([User]),
		JwtModule.registerAsync({
			imports: [ConfigModule],
			useFactory: async (config: ConfigService) => ({
				secret: config.get("SECRET"),
				signOptions: {
					expiresIn: config.get("JWT_EXPIRESIN")
				}
			}),
			inject: [ConfigService]
		})
	],
	controllers: [BaseController, UserController],
	providers: [UserService],
	exports: [UserService]
})
export class UserModule {
}
